<template>
  <div>
    <zm-dialog title="公海规则说明" :visible.sync="value" append-to-body :before-close="dialogClose" :close-on-click-modal="false" :keep-alive="true">
      <el-table :data="saleData" border class="wp100 mb10">
        <el-table-column prop="customerTypeName" align="center" label="客户类型" width="180">
        </el-table-column>
        <el-table-column prop="days" align="center" label="销售单未成交天数(天)">
        </el-table-column>
      </el-table>

      <el-table :data="followData" border class="wp100 mb10">
        <el-table-column prop="customerTypeName" align="center" label="客户类型" width="180">
        </el-table-column>
        <el-table-column prop="days" align="center" label="无跟进记录(天)">
        </el-table-column>
      </el-table>

      <el-table :data="receiveData" border class="wp100 mb10">
        <el-table-column prop="customerTypeName" align="center" label="客户类型" width="180">
        </el-table-column>
        <el-table-column prop="days" align="center" label="原销售员领回原来客户(天)">
        </el-table-column>
      </el-table>
      <div class="ti30">
        超过N天“未成交”“未跟进”的客户，由系统定时划入公海。从开启公海或获得客户（转移、从公海抢到客户）开始来计算客户多久未达到“成交”和“跟进”状态。
      </div>
      <div slot="footer" class="tr">
      </div>
    </zm-dialog>
  </div>
</template>
<script>
import dialogMixin from '@/mixins/dialogMixin'
import {getPublicRule} from '@/api/src/customerSet'
export default {
  name: 'RulesRmark',
  components: {},
  mixins: [dialogMixin],
  props: {

  },
  data () {
    return {
      saleData: [],
      followData: [],
      receiveData: []
    }
  },
  computed: {
  },
  watch: {},
  created () {
    this.getInfo()
  },
  methods: {
    async getInfo () {
      const res = await getPublicRule()
      const _defaultTypeData = [
        {
          value: '1',
          label: '个人客户'
        },
        {
          value: '2',
          label: '企业客户'
        },
        {
          value: '3',
          label: '地产客户'
        },
        {
          value: '0',
          label: '所有客户'
        }
      ]
      res.map(i => {
        const list = _defaultTypeData.find(ii => {
          return ii.value === i.customerType
        })
        i.customerTypeName = list.label
      })
      this.saleData = res.filter(item => {
        return item.switchId === '1'
      })
      this.followData = res.filter(item => {
        return item.switchId === '2'
      })
      this.receiveData = res.filter(item => {
        return item.switchId === '3'
      })
    }
  }
}
</script>
<style scoped lang='scss'>
.ti30 {
  text-indent: 30px;
}
</style>
